package com.lxg.controller.firstController;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * 该控制类用于页面和控制类之间的跳转
 */

@Controller
public class FirstJump {

    //    跳转到登录页面,登录页面名称为(login.html)
    @RequestMapping("/login")
    public String login(HttpSession session){
        session.removeAttribute("flag1");
        return "/first/login";
    }

    //    跳转到注册页面去，注册页面名称为(register.html)
    @RequestMapping("/regist")
    public String register(HttpSession session){
        session.setAttribute("flag1","true");
        return "/first/login";
    }

    //    退出登录
    @RequestMapping("/logout")
    public String logout(HttpServletRequest req, HttpSession session) {
        session.removeAttribute("name");
        session.removeAttribute("user");
        session.removeAttribute("myBooksSize");
        session.removeAttribute("isEmpty");
        session.removeAttribute("noEmpty");
        return"/first/login";
    }
}
